Public Class QuestionPanel
    Private _Selected As Boolean = False
    Private _Question As Integer = 0
    Private _BackColor1 As Color = Color.SkyBlue
    Private _BackColor2 As Color = Color.Blue
    Public Panel As QuestionPNL
    Public Ans As New List(Of String)
    Public Quest As String = ""
    Public Correct As Integer = 0
    Public Property Selected() As Boolean
        Get
            Return _Selected
        End Get
        Set(ByVal value As Boolean)
            _Selected = value
            Redraw()
        End Set
    End Property
    Public Property Question() As Integer
        Get
            Return _Question
        End Get
        Set(ByVal value As Integer)
            _Question = value
            lbl1.Text = value
            Redraw()
        End Set
    End Property
    Public Property BackColor1() As Color
        Get
            Return _BackColor1
        End Get
        Set(ByVal value As Color)
            _BackColor1 = value
            Redraw()
        End Set
    End Property
    Public Property BackColor2() As Color
        Get
            Return _BackColor2
        End Get
        Set(ByVal value As Color)
            _BackColor2 = value
            Redraw()
        End Set
    End Property

    Private Sub QuestionPanel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
        If Selected = True Then
            Exit Sub
        End If
        Selected = False 'TODO: change this back to TRUE
        Cursor = Cursors.Default
        lbl1.Cursor = Cursors.Default
        Clicked()
    End Sub
    Public Sub Clicked()

        Panel.Show()
        Panel.Answers = Ans

        Panel.Correct = Correct
        Panel.Question = Quest
        Panel.DrawForm()
    End Sub
    Private Sub QuestionPanel_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Redraw()
    End Sub
    Public Sub Redraw()
        Dim bmp As New Bitmap(Me.Width, Me.Height)
        Dim graph As Graphics = Graphics.FromImage(bmp)
        Dim shadow As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, bmp.Width, bmp.Height), Color.FromArgb(100, Color.Gray), Color.FromArgb(100, Color.Gray), Drawing2D.LinearGradientMode.Horizontal)
        graph.FillRectangle(shadow, New Rectangle(3, 3, Me.Width, Me.Height))
        Dim b1 As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, bmp.Width - 3, bmp.Height - 3), BackColor1, BackColor2, Drawing2D.LinearGradientMode.Vertical)
        Dim path As New Drawing2D.GraphicsPath
        path.AddArc(New Rectangle(0, 0, Me.Width * 2, Me.Height * 3), 0, 360)
        Dim PB As New Drawing2D.PathGradientBrush(path)
        PB.CenterColor = Color.FromArgb(0, Color.Gray)
        PB.CenterPoint = New Point(Me.Width, Me.Height * 1.5)
        PB.SurroundColors = New Color() {Color.FromArgb(75, Color.Snow)}
        graph.FillRectangle(b1, New Rectangle(0, 0, Me.Width - 3, Me.Height - 3))
        graph.FillRectangle(PB, New Rectangle(0, 0, (Me.Width - 3) * 2, (Me.Height - 3) * 3))
        If _Selected = True Then
            Dim tB As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.Percent75, Color.Gray, Color.Transparent)
            graph.FillRectangle(tB, New Rectangle(0, 0, Me.Width - 3, Me.Height - 3))
            lbl1.ForeColor = Color.DarkGray
        Else : lbl1.ForeColor = Color.Black
        End If
        Me.BackgroundImage = bmp
        lbl1.Location = New Point(((Me.Width - 3) / 2) - (lbl1.Width / 2), ((Me.Height - 3) / 2) - (lbl1.Height / 2))
    End Sub

    Private Sub QuestionPanel_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
        If Me._Selected = True Then
            Cursor = Cursors.Default
            lbl1.Cursor = Cursors.Default
            Exit Sub
        Else : Cursor = Cursors.Hand
            lbl1.Cursor = Cursors.Hand
        End If
    End Sub

    Private Sub QuestionPanel_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
        Cursor = Cursors.Default
    End Sub

    Private Sub QuestionPanel_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
        Redraw()
    End Sub

    Private Sub lbl1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbl1.Click
        If Selected = True Then
            Exit Sub
        End If
        Selected = False
        Cursor = Cursors.Default
        lbl1.Cursor = Cursors.Default
    End Sub
End Class
